﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace ExhibitionDraw.Common
{
    public interface IBehavior
    {
        void MouseDown(object sender, MouseButtonEventArgs e);
        void MouseMove(object sender, MouseEventArgs e);
        void MouseUp(object sender, MouseButtonEventArgs e);
        void Attach(Canvas cs);//关联鼠标事件
        void Detach();//释放鼠标事件
    }

    public abstract class BehaviorBase : IBehavior
    {
        protected Canvas CS;
        public void Detach()
        {
            CS.MouseLeftButtonUp -= MouseUp;
            CS.MouseLeftButtonDown -= MouseDown;
            CS.MouseMove -= MouseMove;
           
        }

         public abstract void MouseDown(object sender, MouseButtonEventArgs e);

        public abstract void MouseMove(object sender, MouseEventArgs e);

        public abstract void MouseUp(object sender, MouseButtonEventArgs e);
    }
}
